﻿<?php
session_start();
date_default_timezone_set("Asia/Chongqing");
include("../config/connect.php");
require_once("../public/common.php");
require_once("../public/biaoqing.php");

if( !HasLogin() ) 
{
	$url = "Location:login.php?ref=edit.php";
	header($url);
}

$email = $_SESSION["email"];
$userid = $_SESSION["userid"];
$nickname = $_SESSION["nickname"];
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?PHP echo $nickname; ?>家的宝贝 - 兔丝街</title>
<link type="text/css" rel="stylesheet" href="../css/base.css" />
<link type="text/css" rel="stylesheet" href="../css/person.css" />
</head>

<?PHP
if(isset($_POST["submit"])){
	//$iemail = trim(GetPostParamStr("iemailaddress")); //电子邮箱
	$inickname = trim(GetPostParamStr("inickname")); //昵称
	$isex = trim(GetPostParamStr("igender")); //性别
	$iphone = trim(GetPostParamStr("iphone")); //联系电话
	$iqq = trim(GetPostParamStr("qqNumber")); //QQ
	$txtSelfIntro = trim(GetPostParamStr("txtSelfIntro")); //个人介绍
	
	$sql="select * from tsj_user where id='$userid' limit 1";
	$result=mysql_query($sql);

	if(mysql_num_rows($result) > 0) {
		$row = mysql_fetch_assoc( $result );

		$sql="update tsj_user set nick_name='$inickname', phone='$iphone', qq='$iqq', sex='$isex', idesc='$txtSelfIntro' where id=$userid";
		mysql_query($sql)or die("数据库边接有误 " . mysql_error());;
		echo "<script>alert('个人资料修改成功！');</script>";
	}
}
//获取个人资料
$sql = "select * from tsj_user where id=$userid limit 1";
$row = mysql_fetch_assoc(mysql_query($sql));
?>

<body class="bGerenxx">
<div id="wrapper">
<!---head kaishi--->
     <?php
		include("../headtop.php"); 
	?>
<!-----head 结束----->
    <div id="main" class="person">
    	<!---左侧开始--->
    	<div class="grid_3">
        	<div class="person_left">
            	<div class="person_info">
                    <!---侧栏导航 kaishi--->
					<?php
                    	include("sidebarnav.php"); 
                    ?>
                    <!------------>
                </div>            	
            </div>
        </div>
 
         <!---右侧--->
      	<div class="grid_9"> 
        	<div id="editGoods">
            <div class="edit_left Personal">
                <div class="Per">
                	<ul>

                		<li class="as"><a href="edit.php">我的资料</a></li>
                        <li><a href="avatar_edit.php">上传/编辑头像</a></li>
                        <li><a href="reset_paw.php">修改密码</a></li>
                    </ul>
                </div>
                <form id="frm" action="" method="post" onsubmit="javascript:return OnSubmit()">
                    <div class="edit_div">
                        <div class="s1">昵 称：</div>
                        <div class="s2"><input type="text" size="70" id="inickname" name="inickname" height="20" value="<?php echo $row["nick_name"]; ?>" /></div>
                        <div class="s3"></div>
                    </div>
                   	<div class="edit_div">
                        <div class="s1">性 别：</div>
                        <div class="s2 titleBox">
                        	<input type="radio" class="info_radio01" value="0" id="genderF" name="igender" <?php if($row["sex"] == 0) echo "checked='checked'"; ?> >&nbsp;女&nbsp;&nbsp;&nbsp;&nbsp;
                            <input type="radio" class="info_radio01" value="1" id="genderM" name="igender" <?php if($row["sex"] == 1) echo "checked='checked'"; ?>>&nbsp;男</div>
						<div class="s3"></div>
                    </div>
                    <div class="edit_div">
                        <div class="s1">联系手机：</div>
                        <div class="s2"><input type="text" size="70" name="iphone" id="iphone" height="20" value="<?php echo $row["phone"]; ?>" /></div>
						<div class="s3">请正确填写您的手机号码，以便于我们及时的与您联系</div>
                    </div>
                    <div class="edit_div">
                        <div class="s1">QQ：</div>

                        <div class="s2"><input type="text" size="70" height="20" name="qqNumber" id="qqNumber" value="<?php echo $row["qq"]; ?>" /></div>
                        <div class="s3"></div>
                    </div>
                    <div class="edit_div egit_desc">
                        <div class="s1">个人介绍：</div>
                        <div class="s2"><textarea name="txtSelfIntro" id="txtSelfIntro" class="iTextArea" cols="20" rows="6" onblur=""><?php echo $row["idesc"]; ?></textarea></div>
                        <div class="s3"></div>
                    </div>

                    <div class="edit_div">
                        <input type="hidden" name="itemid" id="itemid" value="" />
                        <div class="btn"><input type="submit" name="submit" value="保存" class="ed_h" style=" width:80px;" /></div>
                    </div>
                </form>
            </div>

        	</div>          
        </div>
    </div>
</div>
<!---网尾 kaishi--->
 <?php
     include("../networkend.php"); 
?>
<!------------>
</body>
</html>
<script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F22b7662ec7d02c816ddfd8f6df6e5cea' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-20984072-3']);
  _gaq.push(['_trackPageview']);
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>